<template>
	<view >
		<view class="formModel">
		<view class="cu-form-group">
			<view class="title">员工名称</view>
			<input maxlength="5" v-model="userName" placeholder="请输入您的名称" name="input"></input>
		</view>
		<view class="cu-form-group">
			<view class="title">员工电话</view>
			<input maxlength="11" type="number" disabled="false" :placeholder="userPhone" name="input"></input>
		</view>
		<view class="cu-form-group">
			<view class="title">员工地址</view>
			<input v-model="address" placeholder="请输入您的住址" name="input"></input>
		</view>
		
	</view>
	</view>
</template>
<script>
	
	export default {
		data() {
			return {
				selectCountyIndex:0,
				index: 0,
				farmId:'',
				userName:'',
				userPhone:'',
				address:'',
				textValue:'',
				picker: [ '无', '阳光养殖场', '星光养殖场', '月光养殖场'],
			};
		},
		onReady() {
			// console.log(this.User.userInfo)
			this.userPhone = this.User.userInfo.phone
		},
		onNavigationBarButtonTap(){
			this.addStaff()
		},
		onLoad(option) {
			// console.log(option.farmId)
			this.farmId = option.farmId
		},
		methods:{
			//员工数据提交
			addStaff(){
				uni.request({
					url:this.confige.webUrl+"/addStaff",
					data:{
						farm_id:this.farmId,
						staff_name:this.userName,
						staff_phone:this.userPhone,
						staff_address:this.address,
						info:this.textValue
					},
					header:{
						'X-Token':this.User.token
					},
					method:"POST",
					success: (res) => {
						console.log(res)
						if(res.data.code ==200){
							uni.showModal({
								showCancel:false,
								title:"提示",
								content:"您的申请信息已经提交，请等待养殖场主审核！",
								success:(res) => {
									if (res.confirm) {
									    uni.switchTab({
									        url: '../index/index'
									    });
									}
								}
							})
						}
					}
				})
			},
			
		}
	}
</script>

<style lang="less" scoped>
@import "../../common/colorui/main.css";
@import "../../common/colorui/icon.css";
@import "../../common/global.less";
page{ }
.RadioStyle{ 
	radio{
		margin-right: 10rpx;
		font-size: 30rpx;
		}
	}
.bottomModel{
margin-top: 50rpx;
// .butStyle{font-size: 30rpx; border-radius: 90rpx;width: 600rpx; height:80rpx;line-height: 80rpx;color:#FFFFFF; background-color:@maincolor;}
}
.formModel{
background-color:@backcolorthree;
border-bottom:2rpx solid #eaeaea;
.cu-form-group {
.title {min-width: calc(4em + 15px);}		
}
}

</style>
